# -*- coding: UTF-8 -*-
# name='com.tencent.qqmusic'
# versionCode='901'
# versionName='8.8.5.8'

# launchable-activity: name='com.tencent.qqmusic.activity.AppStarterActivity'
# label=''
# icon=''

# 导入所需的方法
from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice
# from com.android.monkeyrunner.recorder import MonkeyRecorder as recorder


#连接我的Nokia手机
print ("Connecting device.....")
NokiaDevice = MonkeyRunner.waitForConnection()
# recorder.start(NokiaDevice)
if not NokiaDevice:
    print ("Please connect a device to start!")
else:
    print ("Device Connected successfully!")

#重启设备
# print("Reboot device!")
# NokiaDevice.reboot()
# MonkeyRunner.sleep(60)

#唤醒设备
print("Wake device")
NokiaDevice.wake()
print("wait 2s")
MonkeyRunner.sleep(2)

#解锁 输入密码
print("unlock device....")
NokiaDevice.drag((400,700),(400,300),0.1,10)
MonkeyRunner.sleep(2)
NokiaDevice.type('1993')
print("unlock successfully")


# device_name = '6e0dc4ab'
# device = MonkeyRunner.waitForConnection(6, device_name)
# the_address = r'C:\Users\Administrator\Desktop\QQ.apk'
# NokiaDevice.installPackage("D:\BaiduNetdiskDownload\ViewServer.apk")
print("start wechat")
component_name = "com.tencent.mm/.ui.LauncherUI"
NokiaDevice.startActivity(component=component_name)
